﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using jiaju.Models.DBModel;
using jiaju.Models.DAL;
using jiaju.Models;

namespace jiaju.Controllers
{
    public class NewsDetailController : Controller
    {
        // GET: NewsDetail More
        public ActionResult Index(string Id)
        {
            List<NewsType> list = NewsTypeService.getAllType();
            ViewBag.A = list;
            News news = NewsService.getNewsDetail(Id);
            ViewBag.B = news;
            return View();
        }
        public ActionResult More()
        {
            List<News> more = NewsTypeService.getMore();
            ViewBag.A = more;
            return View();
        }
        //DelPage
        public ActionResult DelPage(int page, int limit)
        {
            //分页
            List<News> list = NewsTypeService.getPageList(page, limit);
            //获取数据条数
            string sql = "select COUNT(*) from dbo.news";
            int count = (int)DBHelp.ExcuteScalar(sql);
            return Json(new
            {
                success = true,
                count = count,
                data = list
            });
        }
    }
}